package com.sgy.config;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * 线程池配置
 * @author shenguangyang
 * @date 2022-03-29 19:30
 */
@ConfigurationProperties(prefix = "thread-pool")
public class ThreadPoolProperties {
    /** 核心线程数 */
    private Integer corePoolSize = 2;
    /** 最大线程数 */
    private Integer maxPoolSize = Runtime.getRuntime().availableProcessors() * 2;
    /** 队列数 */
    private Integer queueCapacity = 100;
    /* 当线程空闲时间达到keepAliveTime, 该线程会退出 */
    private Integer keepAliveSeconds = 60;

    public Integer getCorePoolSize() {
        return corePoolSize;
    }

    public void setCorePoolSize(Integer corePoolSize) {
        this.corePoolSize = corePoolSize;
    }

    public Integer getMaxPoolSize() {
        return maxPoolSize;
    }

    public void setMaxPoolSize(Integer maxPoolSize) {
        this.maxPoolSize = maxPoolSize;
    }

    public Integer getQueueCapacity() {
        return queueCapacity;
    }

    public void setQueueCapacity(Integer queueCapacity) {
        this.queueCapacity = queueCapacity;
    }

    public Integer getKeepAliveSeconds() {
        return keepAliveSeconds;
    }

    public void setKeepAliveSeconds(Integer keepAliveSeconds) {
        this.keepAliveSeconds = keepAliveSeconds;
    }
}
